package fr.teuteuf.runstickmanrun.entity.comparator;

import java.util.Comparator;

import fr.teuteuf.runstickmanrun.entity.Player;

public class ComparatorPlayerByDistance implements Comparator<Player> {

	@Override
	public int compare(Player o1, Player o2) {
		int returnValue;
		
		if(o1.getPosition().x < o2.getPosition().x) {
			returnValue = 1;
		} else if(o1.getPosition().x > o2.getPosition().x) {
			returnValue = -1;
		} else {
			returnValue = 0;	
		}
		
		return returnValue;
	}

}
